﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace MyBlog
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.LowercaseUrls = true;
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional },
                constraints: new { controller = "^home|system|account|words$" }
            );

            routes.MapRoute(
               name: "userBlog",
               url: "{username}/{controller}/{action}/{id}",
               defaults: new { controller = "blog", action = "index", id = UrlParameter.Optional }
           );

            routes.MapRoute(
                name: "Default2",
                url: "{controller}/{action}",
                defaults: new { controller = "Home", action = "Index" }
           );
        }
    }
}